<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>欺骗词法</title>
</head>
<body>
<script>
    function foo(str,a) {
        eval(str);  // 词法欺骗
        console.log(a,b); // 1,3 ? 并不是b=2. 因为eval("var b=3");
    }
    var b =2;
    foo("var b = 3;", 1);

</script>
</body>
</html>
